home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Magnum One
/
Magnum One (Mid-American Digital) (Disc Manufacturing).iso
/
d12
/
mflms101.arc
/
MFLFILES.H
< prev
next >
Wrap
C/C++ Source or Header
|
1989-11-25
|
13KB
|
327 lines
/************************************************************************/
/* */
/* MFLFILES Header file */
/* */
/* Function prototypes for file system access functions. */
/* */
/* Copyright 1989 by Robert B. Stout dba MicroFirm */
/* All rights reserved */
/* */
/* Copyright 1986, 1987 by S.E. Margison */
/* */
/* Compiled by QC 2.0 for use with MSC 5.1 or QC 2.0 or later. */
/* */
/************************************************************************/
#ifndef MFLFILES_H
#define MFLFILES_H
#include <stdio.h>
#include <dos.h>
#include <mfldefs.h>
/*
** ANSI definitions
*/
#ifndef _Cdecl_
#ifdef NO_EXT_KEYS
#define _Cdecl_
#else
#define _Cdecl_ cdecl
#endif
#endif
/************************************************************************/
/* */
/* Check for the existance of a file */
/* */
/************************************************************************/
int _Cdecl_ exists(char *);
/************************************************************************/
/* */
/* Change/verify disk drives or directories */
/* */
/************************************************************************/
int _Cdecl_ chdrv(char);
LOGICAL _Cdecl_ drvalid(char);
char _Cdecl_ getdrv(void);
int _Cdecl_ pushdir(char *);
int _Cdecl_ popdir(void);
/************************************************************************/
/* */
/* File operations using FCB functions */
/* */
/************************************************************************/
struct XFCB
{
unsigned char header[6];
unsigned char attribute;
unsigned char drive;
unsigned char fname[8];
unsigned char fext[3];
int curr_block;
int rec_size;
long file_size;
unsigned int date;
unsigned int time;
char reserved[8];
unsigned char curr_rec;
long rand_rec;
} ;
int _Cdecl_ FCB_creat(char *, int);
int _Cdecl_ FCB_kill(char *, int);
struct XFCB * _Cdecl_ FCB_open(char *, int);
int _Cdecl_ FCB_close(struct XFCB *);
int _Cdecl_ FCB_reads(struct XFCB *, void *);
int _Cdecl_ FCB_writes(struct XFCB *, void *);
int _Cdecl_ FCB_readr(struct XFCB *, void *, long);
int _Cdecl_ FCB_writer(struct XFCB *, void *, long);
/************************************************************************/
/* */
/* Manipulate volume labels */
/* */
/************************************************************************/
char * _Cdecl_ flretvol(char);
int _Cdecl_ flremvol(char);
int _Cdecl_ flsetvol(char, char *);
/************************************************************************/
/* */
/* Delete files using FCB's - very fast with wildcards! */
/* */
/************************************************************************/
int _Cdecl_ del_files(char *, char *);
/************************************************************************/
/* */
/* Copy files */
/* */
/************************************************************************/
int _Cdecl_ fcopy(char *, char *, int);
/************************************************************************/
/* */
/* Expand command line wildcard arguments */
/* */
/************************************************************************/
extern char **nargv;
int _Cdecl_ expand_args(int, char *[]);
/************************************************************************/
/* */
/* Directory operations using file-type functions */
/* */
/************************************************************************/
typedef struct
{
int dd_fd;
unsigned dd_loc,
dd_size;
struct find_t dd_buf;
char dd_dirname[MAX_FLEN];
} DOS_DIR;
DOS_DIR * _Cdecl_ opendir(char *);
void _Cdecl_ closedir(DOS_DIR *);
struct find_t * _Cdecl_ readdir(DOS_DIR *);
int _Cdecl_ dirmask(struct find_t *,char *,char *,unsigned,unsigned);
extern int DFerr;
extern DOS_DIR _DIRS[];
/************************************************************************/
/* */
/* Stream functions for installable stream filters. */
/* */
/************************************************************************/
typedef struct {
int idx;
char mode[4];
FILE *fp;
int flag; /* Bit-mapped - 0-7 current char
8-12 undefined
13 in use
14 locked
15 eof */
#define SF_CHAR_MASK 0xff
#define SF_EOF_MASK 0x8000
#define SF_CHEOF_MASK 0x80ff
#define SF_LOCK_MASK 0x4000
#define SF_INUSE_MASK 0x2000
int ( _Cdecl_ *hook)();
int ( _Cdecl_ *unhook)();
void ( _Cdecl_ *chain)(char *, int);
void ( _Cdecl_ *flush)(int);
} SFILE;
#define SFOPEN_MAX FOPEN_MAX + 16
extern SFILE _siob[SFOPEN_MAX];
typedef struct {
void ( _Cdecl_ *filt)(char *, int);
void ( _Cdecl_ *flush)(int);
void ( _Cdecl_ *chain[SFOPEN_MAX])(char *, int);
} SFILTER;
SFILE * _Cdecl_ sfopen(const char *, const char *);
int _Cdecl_ sclose(SFILE *);
int _Cdecl_ sfputc(int, SFILE *);
int _Cdecl_ sfputs(const char *, SFILE *);
size_t _Cdecl_ sfwrite(const void *, size_t, size_t, SFILE *);
int _Cdecl_ sfgetc(SFILE *);
char * _Cdecl_ sfgets(const void *, int, SFILE *);
size_t _Cdecl_ sfread(const void *, size_t, size_t, SFILE *);
LOGICAL _Cdecl_ sfinstall(SFILE *, SFILTER *);
/************************************************************************/
/* */
/* Simple stream filters */
/* */
/************************************************************************/
extern SFILTER ucase_filt,
lcase_filt;
/************************************************************************/
/* */
/* Stream encryption function */
/* */
/************************************************************************/
int _Cdecl_ crypt_install(SFILE *, char *, int);
/************************************************************************/
/* */
/* Stream compression/expansion functions */
/* */
/************************************************************************/
int _Cdecl_ ncode_install(SFILE *);
int _Cdecl_ dcode_install(SFILE *);
/************************************************************************/
/* */
/* File truncation functions */
/* */
/************************************************************************/
int _Cdecl_ trunc(int, long);
int _Cdecl_ ftrunc(FILE *, long);
int _Cdecl_ truncate(char *, long);
/************************************************************************/
/* */
/* Filename parsing functions */
/* */
/************************************************************************/
#define EXTENSION 1
#define FILENAME 2
#define DIRECTORY 4
#define DRIVE 8
#define WILDNAME 16
#define WILDPATH 32
int _Cdecl_ fnsplit(char *,char *,char *,char *,char *,char *,char *);
char * _Cdecl_ fnmerge(char *,char *,char *,char *,char *,char *,char *);
int _Cdecl_ has_wild(char *);
#define DOS_STYLE 1
#define UNIX_STYLE 2
#define BOTH_STYLES 3
int _Cdecl_ wildname(char *, char *, int);
/************************************************************************/
/* */
/* Normalize file names */
/* */
/************************************************************************/
int _Cdecl_ flnorm(char *, char *);
char * _Cdecl_ fln_fix(char *);
char * _Cdecl_ unix2dos(char *);
/************************************************************************/
/* */
/* Open files using a path specification */
/* */
/************************************************************************/
FILE * _Cdecl_ fopenp(char *, char *),
* _Cdecl_ fopeng(char *, char *, char *),
* _Cdecl_ fopend(char *, char *, char *);
int _Cdecl_ openp(char *, int),
_Cdecl_ opend(char *, int, char *),
_Cdecl_ openg(char *, int, char *),
_Cdecl_ getpath(char *);
/************************************************************************/
/* */
/* Structures & functions for accessing file dates and times */
/* */
/************************************************************************/
#ifndef FTIME_DEF__
#define FTIME_DEF__
struct ftime {
unsigned int ft_tsec : 5;
unsigned int ft_min : 6;
unsigned int ft_hour : 5;
unsigned int ft_day : 5;
unsigned int ft_month : 4;
unsigned int ft_year : 7;
} ;
int _Cdecl_ getftime(int, struct ftime *);
int _Cdecl_ setftime(int, struct ftime *);
int _Cdecl_ touch(char *);
void _Cdecl_ get_filetime(struct tm *, int);
#endif /* FTIME_DEF__ */
/************************************************************************/
/* */
/* File extension functions */
/* */
/************************************************************************/
void _Cdecl_ badext(char *),
_Cdecl_ newext(char *, char *, char *);
int _Cdecl_ exttyp(char *, char *);
/************************************************************************/
/* */
/* Miscellaneous functions */
/* */
/************************************************************************/
void _Cdecl_ eraok(char *),
_Cdecl_ cant(char *),
_Cdecl_ exit2dos(void);
int _Cdecl_ repchar(char, int, FILE *),
_Cdecl_ iscons(FILE *);
#endif /* MFLFILES_H */